class CopyrightWebpackPlugin {
    apply (compiler) {

        compiler.hooks.compile.tap('CopyrightWebpackPlugin', (compilation) => {
            console.log('complier')
        })

        // 所有打包的东西
        compiler.hooks.emit.tapAsync('CopyrightWebpackPlugin', (compilation, cb) => {
            compilation.assets['copyright.txt'] = {
                source: function () {
                    return 'copyright by webpack'
                },
                size: function () {
                    return 30;
                }
            }
            cb()
        })
    }
}

module.exports = CopyrightWebpackPlugin